Skip to content

feat(cli): ulk agents stats — registry composition + count reconciliation (#1)#195

Merged
izo merged 1 commit into
mainfrom
claude/agent-usage-stats
Jun 8, 2026
Merged

feat(cli): ulk agents stats — registry composition + count reconciliation (#1)#195
izo merged 1 commit into
mainfrom
claude/agent-usage-stats

Conversation

@izo

@izo izo commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Implements chantier #1 agent-usage-stats from the « maturité v7 » epic (PR #194). Independent branch off main.

What it does

New Go subcommand:

ulk agents stats [--json] [--usage] [--source DIR]
  • Composition from framework/agents/registry.json (source of truth) — by category, model, phase, with an internal count-field consistency check.
  • Count reconciliation — compares the agent count declared in registry.md, CLAUDE.md, AGENTS.md, framework/agents/CLAUDE.md against the registry and flags drift.
  • --usage — best-effort runtime overlay from .ulk-reports/accountability.jsonl, with a loud attribution-coverage caveat. Missing journal degrades gracefully.

Sample output (this repo):

  Total agents : 98  (registry count field: ✓)
  By model      sonnet 71 · opus 24 · haiku 3
  Count reconciliation (source of truth = registry: 98)
    framework/agents/registry.md   98  ✓
    CLAUDE.md                      98  ✓
    AGENTS.md                      98  ✓
    framework/agents/CLAUDE.md     98  ✓

Count reconciliation (the card's first goal)

The drift was real: registry 98 vs CLAUDE.md 95 vs AGENTS.md/agents/CLAUDE.md 94. This PR:

  1. Regenerated registry.json/registry.md (main was stale at 97 — first commit).
  2. Reconciled all declared counts to 98.

⚠️ Design blocker (important)

accountability.jsonl has an agent field, but attribution is not yet auto-propagated (accountability protocol v1.1 → v1.2 roadmap) — most entries are agent: "unknown". So per-agent invocation stats and reliable "dead agent" detection are NOT derivable today.

Consequence for the card's "identify dead trail (171→~40)" goal: the command cannot reliably flag unused agents yet. It reports attribution coverage instead of claiming disuse, and never presents absence of activity as proof. Unblocking this requires the accountability v1.2 auto-propagation work — a dependency worth surfacing in the epic.

Tests

go build + go vet + go test ./... all green. New tests: loader, Stats, count-field drift, accountability parsing + attribution ratio (internal/registry), declared-count regex against the 4 real doc phrasings + sort helper (cmd).

Code

  • framework/cli/internal/registry/agents.go — loader + Stats() + LoadAgentUsage() (parsing/computation)
  • framework/cli/cmd/agents.go — command + reconciliation + rendering (thin adapter)

Draft: the registry-composition + reconciliation half is complete and reliable. The usage half is intentionally caveated pending accountability v1.2. Archiving procedure (card AC) is not included — it should follow once usage attribution is trustworthy.

https://claude.ai/code/session_01JrFhrsWDBZVZBRMN6MiXG4


Generated by Claude Code

@izo izo marked this pull request as ready for review June 8, 2026 07:09
…tion

Implements chantier #1 (agent-usage-stats). New subcommand:
  ulk agents stats [--json] [--usage] [--source DIR]

- Reads framework/agents/registry.json (source of truth) → composition by
  category / model / phase, with internal count-field consistency check.
- Reconciles the agent count declared in registry.md / CLAUDE.md / AGENTS.md /
  framework/agents/CLAUDE.md against the registry, surfacing drift.
- --usage overlays best-effort runtime usage from accountability.jsonl, with a
  loud attribution-coverage caveat (NEVER presented as proof of disuse).

Reconciled the declared count to 98 everywhere (was 95 / 94).

Design note (blocker): accountability.jsonl HAS an 'agent' field but attribution
is not yet auto-propagated (protocol v1.1 → v1.2 roadmap), so most entries are
'unknown'. Per-agent invocation stats and reliable 'dead agent' detection are
therefore NOT derivable today — the command reports attribution coverage instead
of claiming disuse. This blocker should feed the accountability v1.2 work.

New code: internal/registry/agents.go (loader + Stats + usage parser),
cmd/agents.go (command + reconciliation). Tests: agents_test.go in both packages.
go build + go vet + go test ./... all green.

https://claude.ai/code/session_01JrFhrsWDBZVZBRMN6MiXG4
@izo izo force-pushed the claude/agent-usage-stats branch from 05ef8ab to 506987c Compare June 8, 2026 07:15
@izo izo merged commit acb8cd1 into main Jun 8, 2026
@izo izo deleted the claude/agent-usage-stats branch June 8, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants